$(document).ready(function(){
    init();

});

function init(){

    var path = location.href;
    var id = path.substring(path.lastIndexOf("/")+1)

    $.ajax({
        url: "/supplier/findById/" + id,
        type: 'GET',
        data: {},
        dataType: "JSON",
        async: false,
        success: function (res) {
            if(res.code == "200") {
                var data = res.data;
                $(".id").val(data.id);
                $(".name").val(data.name);
                $(".supplierName").val(data.supplierName);
                $(".product").val(data.product);
                $(".address").val(data.address);
                $(".details").val(data.details);
                $(".addressPhoto").html("<img style='height: 80px' src=" + data.addressPhoto + ">");

            } else {
                alert(res.msg);
            }
        },
        error: function (e) {
            alert('发生错误')
        }
    })

}